# 赋值
# def func(message):
#     print(f"Got a message:{message}")
#
# 将函数对象赋值给send_message
# send_message = func
# print(func)
# send_message("welcome to DaXiong course") # func()

# 作为参数
# def get_message(message):
#     return f"Got a message:{message}"
#
# def call(func,message):
#     print(func(message))
#
# call(get_message,"welcome to DaXiong course")

# 支持嵌套
# def func(message):
#     def get_message(message):
#         print(f"Got a message:{message}")
#     return get_message(message)
#
# func("welcome to DaXiong course")

# 返回值
def func():
    def get_message(message):
        return f"Got a message:{message}"
    return get_message

send_message = func() # send_message = get_message
message_string = send_message("welcome to DaXiong course") # get_message()
print(message_string)

# 函数可以赋值，作为参数，支持嵌套，作为返回值等，所以它在python中是一等公民